<template>
  <view class="oa-content">
    <!-- 顶部自定义导航 -->
    <view class="">
      <tn-nav-bar customBack :bottomShadow="false" backgroundColor="#FFFFFF">
        <view slot="back" class='tn-custom-nav-bar__back'
          @click="goBack">
          <text class='icon tn-icon-left-arrow'></text>
        </view>
        <view class="tn-flex tn-flex-col-center tn-flex-row-center ">
          <text class="tn-text-bold tn-text-xl" style="color: #0E2D6D;">词典目录</text>
        </view>
      </tn-nav-bar>
    </view>
    
    <view class="search-fixed" :style="{paddingTop: vuex_custom_bar_height + 10 + 'px'}">
      <view class="tn-flex tn-flex-row-between tn-flex-col-center tn-margin">
        
        <view class="justify-content-item align-content-item" style="width: 100vw;">
          <view class="tn-flex tn-flex-col-center tn-bg-white" style="border: 2rpx solid #3467C2;border-radius: 100rpx;padding: 10rpx 20rpx 10rpx 20rpx;width: 90%;">
            <text class="tn-icon-search justify-content-item tn-padding-right-xs tn-text-lg" style="color: #3467C2;"></text>
            <input class="justify-content-item" placeholder="请输入搜索关键词" name="input" placeholder-style="color:#3467C280" style="width: 90%;color: #0E2D6D;"></input>
          </view>
        </view>
        
        <view class="align-content-item">
          <view class="justify-content-item tn-text-center">
            <tn-button backgroundColor="#3467C2" shape="round" padding="20rpx 20rpx" width="150rpx" @tap="">
              <text class="tn-color-white">搜 索</text>
            </tn-button>
          </view>
        </view>
        
      </view>
    </view>
    
    <view class="tn-padding-bottom-xl" :style="{paddingTop: vuex_custom_bar_height + 70 + 'px'}">
      
      <tn-index-list :scrollTop="scrollTop" :indexList="indexList" :customBarHeight="vuex_custom_bar_height + 85" :sticky="false" :key-list-offset-top="54" :stickyTop="vuex_custom_bar_height">
        <view v-for="(item, index) in list" :key="index">
          <tn-index-anchor :index="item.letter"></tn-index-anchor>
            <view v-for="(data_item,data_index) in item.data" :key="data_index" class="">
              
              <view class="tn-text-center" style="padding: 30rpx 30rpx;margin: 40rpx 30rpx;background-color: #F8F7F8;border-radius: 24rpx;color: #0E2D6D;" @click="tn('/momentPages/dictionary')">
                <text class="tn-text-xl tn-text-bold">{{ data_item.name }}</text>
              </view>
              
            </view>
        </view>
      </tn-index-list>
      
      
    </view>
    
  </view>
</template>

<script>
  import template_page_mixin from '@/libs/mixin/template_page_mixin.js'
  import indexList from '@/libs/catalog.list.js'
  const letterArr = indexList.list.map(val => {
    return val.letter
  })
  export default {
    name: 'TemplateContent',
    mixins: [template_page_mixin],
    data(){
      return {
        // 滚动的距离
        scrollTop: 0,
        // 索引列表
        indexList: letterArr,
        list: indexList.list
      }
    },
    onPageScroll(e) {
      this.scrollTop = e.scrollTop
    },
    methods: {
      // 跳转
      tn(e) {
      	uni.navigateTo({
      		url: e,
      	});
      },
    }
  }
</script>

<style lang="scss" scoped>
  /* 胶囊*/
  .tn-custom-nav-bar__back {
    width: 60%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    box-sizing: border-box;
    background-color: rgba(0, 0, 0, 0.15);
    border-radius: 1000rpx;
    border: 1rpx solid rgba(255, 255, 255, 0.5);
    color: #FFFFFF;
    font-size: 18px;
    
    .icon {
      display: block;
      flex: 1;
      margin: auto;
      text-align: center;
    }
    
  }
  
  .oa-content{
    max-width: 640px;
    margin: 0 auto;
    // background-color: #F8F7F8;
    min-height: 100vh;
    padding-bottom: 60rpx;
    padding-bottom: calc(80rpx + env(safe-area-inset-bottom) / 2);
    padding-bottom: calc(80rpx + constant(safe-area-inset-bottom));
  }
  
  // 搜索固定
  .search-fixed{
    max-width: 640px;
    margin: 0 auto;
    position: fixed;
    background-color: #FFFFFF;
    top: 0;
    width: 100%;
    transition: all 0.25s ease-out;
    z-index: 100;
  }
  
   /* 底部悬浮按钮 start*/
   .tn-tabbar-height {
   	min-height: 160rpx;
   	height: calc(180rpx + env(safe-area-inset-bottom) / 2);
     height: calc(180rpx + constant(safe-area-inset-bottom));
   }
   .tn-footerfixed {
     position: fixed;
     width: 100%;
     bottom: calc(40rpx + env(safe-area-inset-bottom));
     z-index: 1024;
     box-shadow: 0 1rpx 6rpx rgba(0, 0, 0, 0);
   
   }
   /* 底部悬浮按钮 end*/
  
</style>
